﻿
using NextEngine.Parser;
using System.Collections.Generic;
namespace NextEngine.HttpEngine
{
    public class CData
    {
        public SendData SendData { get; set; }
        public NParser Parser { get; set; }
        public BackData BackData { get; set; }
    }

    public class SendData
    {
        /// <summary>
        /// 接口名称
        /// </summary>
        public string TailUrl { get; set; }
        /// <summary>
        /// 发送请求的方式
        /// </summary>
        public SendMethod Method { get; set; }
        /// <summary>
        /// 加密方式
        /// </summary>
        public EncryptType EncryptType { get; set; }
        /// <summary>
        /// 头信息
        /// </summary>
        public Dictionary<string, object> Headers { get; set; }
        /// <summary>
        /// 体信息
        /// </summary>
        public Dictionary<string, object> Body { get; set; }

        /// <summary>
        /// Json请求的构造方法
        /// 
        /// 全局的构造方法，可根据自己需要添加自己的构造方法，
        /// 但尽量少一些，避免混乱.
        /// </summary>
        /// <param name="tailUrl"></param>
        /// <param name="method"></param>
        /// <param name="encrytpType"></param>
        /// <param name="headers"></param>
        /// <param name="body"></param>
        public SendData(string tailUrl, SendMethod method, EncryptType encryptType, Dictionary<string, object> headers, Dictionary<string, object> body)
        {
            this.TailUrl = tailUrl;
            this.Method = method;
            this.EncryptType = encryptType;
            this.Headers = headers;
            this.Body = body;
        }
    }

    public class BackData
    {
        public object ResposeData { get; set; }
        public string Msg { get; set; }
        public bool IsSuccess { get; set; }

        public BackData(object hopeData)
        {
            this.ResposeData = hopeData;
        }
    }
}
